<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户ID');
            $table->string('company')->nullable()->comment('受检单位');
            $table->string('team')->nullable()->comment('受检班组');
            $table->text('description')->nullable()->comment('隐患描述');
            $table->text('law')->nullable()->comment('法律法规');
            $table->text('system')->nullable()->comment('体系要素');
            $table->text('grade')->nullable()->comment('隐患分级标准');
            $table->text('peccancy')->nullable()->comment('违章分级标准');
            $table->text('audit')->nullable()->comment('审核类别');
            $table->text('proposal')->nullable()->comment('整改建议');
            $table->string('inspector')->nullable()->comment('检查人签名图片');
            $table->string('unit')->nullable()->comment('受检单位负责人签名');
            $table->string('point')->nullable()->comment('隐患点负责人签名');
            $table->string('rectify')->nullable()->comment('整改负责人签名');
            $table->date('begin_at')->nullable()->comment('检查时间');
            $table->date('end_at')->nullable()->comment('关闭时间');
            $table->string('problem')->nullable()->comment('问题图片');
            $table->string('rectification')->nullable()->comment('整改图片');
            $table->json('extended_data')->nullable()->comment('扩展数据');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
